﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace coliseu.BussinessLayer
{
    public class Tipo_servicoBL
    {
          private coliseuEntities cEntities;

          public Tipo_servicoBL()
        {
            cEntities = new coliseuEntities(Properties.Settings.Default.conn_coliseu);
        }

        public List<tipo_servico> selecionar()
        {
            return (from x in cEntities.tipo_servico select x).ToList();
        }

        public void salvar(tipo_servico b, string tipo)
        {

            if (tipo == "insert")
            {
                cEntities.AddTotipo_servico(b);
            }
            else
            {
                cEntities.tipo_servico.ApplyCurrentValues(b);
            }
            cEntities.SaveChanges();
        }

        public void excluir(tipo_servico b)
        {
            cEntities.tipo_servico.DeleteObject(b);
            cEntities.SaveChanges();
        }
    }
}
